<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<head>		
		<title></title>
		  <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>基本地图展示</title>
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
    <script src="http://cache.amap.com/lbs/static/es5.min.js"></script>
    <!--
    	作者：764480506@qq.com
    	时间：2017-03-08
    	描述：普通地图
    	<script src="http://webapi.amap.com/maps?v=1.3&key=e06178925b8ec4746ca36a53593d07dd"></script>
    -->
    
    <script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
    <!--
    	作者：764480506@qq.com
    	时间：2017-03-08
    	描述：带功能控件地图
    	<script src="http://webapi.amap.com/maps?v=1.3&key=e06178925b8ec4746ca36a53593d07dd&&plugin=AMap.Scale,AMap.OverView,AMap.ToolBar"></script>
    -->
    <script src="http://webapi.amap.com/maps?v=1.3&key=e06178925b8ec4746ca36a53593d07dd&&plugin=AMap.Scale,AMap.OverView,AMap.ToolBar"></script>
	</head>
	<body>
		
		  
		<div id="container"></div>
		
		<!--
        	作者：764480506@qq.com
        	时间：2017-03-08
        	描述：中英文地图
        -->
		<div class="button-group" >
		    <input id="en" type="button" class="button" value="显示英文地图" />
		    <input id="zh_en" type="button" class="button" value="显示中英文对照地图" />
		    <input id="zh_cn" type="button" class="button" value="显示中文地图" />
		 </div>
		 
		 <!--
         	作者：764480506@qq.com
         	时间：2017-03-08
         	描述：带功能控件的地图
         -->
	    <div class='button-group' style="background-color: #0d9bf2;right: 20px">
		    <input type="checkbox" onclick="toggleScale(this)"/>比例尺
		    <input type="checkbox" id="toolbar" onclick="toggleToolBar(this)"/>工具条
		    <input type="checkbox" id="toolbarDirection" disabled onclick="toggleToolBarDirection(this)"/>工具条方向盘
		    <input type="checkbox" id="toolbarRuler" disabled onclick="toggleToolBarRuler(this)"/>工具条标尺
		    <input type="checkbox" id="overview" onclick="toggleOverViewShow(this)"/>显示鹰眼
		    <input type="checkbox" id="overviewOpen" disabled onclick="toggleOverViewOpen(this)"/>展开鹰眼
        </div>
		<!--
        	作者：764480506@qq.com
        	时间：2017-03-08
        	描述：script 必须放在这里否则显示不出来
        -->
        
		 <script>  
		    var map = new AMap.Map('container', {
		        resizeEnable: true,
		        zoom:11,
		        center: [116.397428, 39.90923]
		    });		    
		   
		   //显示中英文地图开始
		    ['en', 'zh_en', 'zh_cn'].forEach(function(btn) {
		      var button = document.getElementById(btn);
		      AMap.event.addDomListener(button,'click',clickListener)
		    });
		
		    function clickListener() {
		        map.setLang(this.id);
		    }
		   //显示中英文地图结束
		   
		   //带功能控件的地图开始
		   var scale = new AMap.Scale({
		        visible: false
		    }),
		    toolBar = new AMap.ToolBar({
		        visible: false
		    }),
		    overView = new AMap.OverView({
		        visible: false
		    }),
		    map = new AMap.Map("container", {
		        resizeEnable: true
		    });
		    map.addControl(scale);
		    map.addControl(toolBar);
		    map.addControl(overView);
		    function toggleScale(checkbox) {
		        if (checkbox.checked) {
		            scale.show();
		        } else {
		            scale.hide();
		        }
		    }
		    function toggleToolBar(checkbox) {
		        if (checkbox.checked) {
		            showToolBar();
		            showToolBarDirection();
		            showToolBarRuler();
		        } else {
		            hideToolBar();
		            hideToolBarDirection();
		            hideToolBarRuler();
		        }
		    }
		    function toggleToolBarDirection(checkbox) {
		        if (checkbox.checked) {
		            toolBar.showDirection()
		        } else {
		            toolBar.hideDirection()
		        }
		    }
		    function toggleToolBarRuler(checkbox) {
		        if (checkbox.checked) {
		            toolBar.showRuler();
		        } else {
		            toolBar.hideRuler();
		        }
		    }
		    function toggleOverViewShow(checkbox) {
		        if (checkbox.checked) {
		            overView.show();
		            document.getElementById('overviewOpen').disabled = false;
		        } else {
		            overView.hide();
		            document.getElementById('overviewOpen').disabled = true;
		        }
		    }
		    function toggleOverViewOpen(checkbox) {
		        if (checkbox.checked) {
		            overView.open();
		        }
		        else {
		            overView.close();
		        }
			}
		    function showToolBar() {
		        document.getElementById('toolbar').checked = true;
		        document.getElementById('toolbarDirection').disabled = false;
		        document.getElementById('toolbarRuler').disabled = false;
		        toolBar.show();
		    }
		    function hideToolBar() {
		        document.getElementById('toolbar').checked = false;
		        document.getElementById('toolbarDirection').disabled = true;
		        document.getElementById('toolbarRuler').disabled = true;
		        toolBar.hide();
		    }
		    function showToolBarDirection() {
		        document.getElementById('toolbarDirection').checked = true;
		        toolBar.showDirection();
		    }
		    function hideToolBarDirection() {
		        document.getElementById('toolbarDirection').checked = false;
		        toolBar.hideDirection();
		    }
		    function showToolBarRuler() {
		        document.getElementById('toolbarRuler').checked = true;
		        toolBar.showRuler();
		    }
		    function hideToolBarRuler() {
		        document.getElementById('toolbarRuler').checked = false;
		        toolBar.hideRuler();
		    }
		    //带功能控件的地图结束
		    
		    
		    
		</script>
		
	</body>
</html>
